<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hello Python</title>

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <meta name="description" content="Hello Pyhton,编程在线学习实验平台">
    <meta property="og:title" content="Hello Pyhton" />
    <meta property="og:description" content="Hello Pyhton,编程在线学习实验平台" />
    <meta property="og:site_name" content="Hellp Python" />
    <meta property="twitter:site" content="Hello Pyhton" />
    <meta property="twitter:description" content="Hello Pyhton,编程在线学习实验平台" />

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css"
        integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="static/js/cm/addon/hint/show-hint.css">
    <link rel="stylesheet" type="text/css" href="static/js/cm/theme/base16-light.css">
    <link rel="stylesheet" type="text/css" href="static\css\major.css">
    <link rel="stylesheet" type="text/css" href="static\css\codemirror.css">
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="static\js\require.js" data-main="static\js\main"></script>
</head>

<body>
    <div class="container-fluid">
        <header class="row">
            <div class="col-md-12">
                <h1>Hello Python</h1>
                <h3>学习实验平台</h3>
            </div>
        </header>
    </div>
    <div id="container">
        <!-- 主要内容 -->
        <div id="content" class="row">
            <!-- 这一行用来放置主要内容 -->

            <div class="col-md-6 doc ">
                <button class="start">
                    <span>
                        <svg t="1589981287827" class="icon" viewBox="0 0 1024 1024" version="1.1"
                            xmlns="http://www.w3.org/2000/svg" p-id="1983" width="200" height="200">
                            <path
                                d="M128 554.666667h42.666667v341.333333a42.666667 42.666667 0 0 0 42.666666 42.666667h597.333334a42.666667 42.666667 0 0 0 42.666666-42.666667v-341.333333h42.666667a42.666667 42.666667 0 0 0 30.165333-72.832l-384-384a42.624 42.624 0 0 0-60.330666 0l-384 384A42.666667 42.666667 0 0 0 128 554.666667z m469.333333 298.666666h-170.666666v-170.666666h170.666666v170.666666zM512 188.330667l283.690667 283.690666A42.752 42.752 0 0 0 768 512v341.333333h-85.333333v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667H384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333H256v-341.333333c0-18.304-11.52-33.877333-27.690667-39.978667L512 188.330667z"
                                fill="#707070" p-id="1984"></path>
                        </svg>
                    </span>
                </button>

                <div class="startMenu">

                    <style>
                        * {
                            margin: 0;
                            padding: 0;
                        }

                        a:-webkit-any-link {
                            color: black;
                            cursor: pointer;
                            text-decoration: none;
                        }

                        .stage2 {
                            padding: 0 0 2%;
                            text-align: center;
                        }

                        .clearfix {
                            zoom: 1;
                            clear: both;
                        }

                        ul {
                            display: block;
                            list-style-type: disc;
                            margin-block-start: 0.5em;
                            margin-inline-start: 0px;
                            margin-inline-end: 0px;
                            margin-bottom: 0;
                        }

                        .stage2 li {
                            display: inline-block;
                            width: 280px;
                            height: 230px;
                            margin: auto 26px 26px;
                            margin-right: 26px;
                            margin-left: 26px;
                            margin-bottom: 26px;
                            text-align: center;
                            background-color: #fff;
                            box-shadow: 0 5px 20px 0 rgba(210, 208, 208, 0.52);
                            border-radius: 4px;
                            overflow: hidden;
                            cursor: pointer;
                            transition: transform .5s ease;
                        }

                        .stage2 svg {
                            margin-top: 10%;
                            width: 60px;
                            height: 60px;
                        }

                        .stage2 li h4 {
                            font-size: 18px;
                            font-weight: 500;
                            color: rgb(10, 73, 145);
                            line-height: 25px;
                            padding-top: 25px;
                        }

                        .stage2 li p {
                            font-size: 14px;
                            line-height: 25px;
                            padding-top: 8px;
                        }

                        .stage2.app_wrap li em {
                            transform: scale(1);
                            margin: 22px auto 0;
                        }

                        .stage2 li:hover {
                            transform: scale(1.15);
                        }
                    </style>

                    <div class="section stage2 app_wrap">
                        <ul class="clearfix">
                            <li class="PythonIndoor" onclick="toIndoor()">
                                <em>
                                    <svg t="1589714731694" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="5910"
                                        data-spm-anchor-id="a313x.7781069.0.i36" width="200" height="200">
                                        <path d="M511.609097 961.619254" p-id="5911"></path>
                                        <path
                                            d="M923.840836 337.518107c-22.539342-53.279461-54.80521-101.128235-95.89914-142.213979-41.09393-41.085744-88.950891-73.344448-142.240585-95.880721-55.177694-23.333428-113.785509-35.164894-174.192298-35.164894-60.406788 0-119.013581 11.831466-174.192298 35.164894-53.289694 22.536272-101.146655 54.794977-142.240585 95.880721-41.094954 41.086767-73.359798 88.934518-95.89914 142.213979-23.338544 55.168484-35.172057 113.765043-35.172057 174.161598 0 60.396555 11.833513 118.992091 35.172057 174.161598 22.540366 53.280484 54.80521 101.128235 95.89914 142.213979 41.09393 41.086767 88.950891 73.345472 142.240585 95.880721 55.178717 23.333428 113.784486 35.164894 174.192298 35.164894 90.549296 0 177.772846-26.901697 252.240885-77.797877 5.66707-3.873214 7.121188-11.607362 3.247974-17.275455-3.873214-5.665023-11.606339-7.120165-17.275455-3.247974-70.316485 48.060599-152.689564 73.463152-238.213403 73.463152-233.048777 0-422.646949-189.561333-422.646949-422.564062s189.598172-422.564062 422.646949-422.564062c233.047754 0 422.646949 189.561333 422.646949 422.564062 0 76.570933-20.692275 151.566998-59.838853 216.882586-3.52836 5.887081-1.616824 13.520945 4.27128 17.050328 5.884011 3.527336 13.520945 1.616824 17.050328-4.27128 41.460274-69.174476 63.375399-148.591223 63.375399-229.661633C959.013917 451.28315 947.180404 392.687614 923.840836 337.518107z"
                                            p-id="5912" data-spm-anchor-id="a313x.7781069.0.i33" class="selected"
                                            fill="#3c78aa"></path>
                                        <path
                                            d="M239.279688 362.118388l177.759543 274.968515 54.080709 0L471.119941 283.621593l-45.181015 0 0 243.021919c0 24.341385 0.759293 41.529859 2.281973 51.570539l-0.912789 0c-1.52268-3.497661-6.389524-11.637038-14.603603-24.416086L239.736083 283.621593l-57.275471 0 0 353.466334 45.181015 0L227.641627 388.589272c0-25.100678-0.60989-41.605583-1.825578-49.517787l1.369184 0C230.226498 346.679767 234.259348 354.360703 239.279688 362.118388z"
                                            p-id="5913" data-spm-anchor-id="a313x.7781069.0.i39" class="selected"
                                            fill="#3c78aa"></path>
                                        <path
                                            d="M638.98002 469.185892 638.98002 447.3864 541.251208 447.3864 541.251208 637.086903 643.265626 637.086903 643.265626 615.411231 565.744042 615.411231 565.744042 551.60502 633.590266 551.60502 633.590266 529.929348 565.744042 529.929348 565.744042 469.185892Z"
                                            p-id="5914" data-spm-anchor-id="a313x.7781069.0.i38" class=""
                                            fill="#fdd835"></path>
                                        <path
                                            d="M884.157022 447.3864l-37.229926 143.898341c-1.959631 7.102768-3.143597 13.30912-3.551896 18.614963l-0.490164 0c-0.817622-7.348362-1.879813-13.388938-3.184529-18.124799l-39.188534-144.388505L776.386506 447.3864l-41.026392 143.286404c-2.286066 8.082072-3.63376 14.572904-4.041036 19.47147l-0.734734 0c-0.327458-6.53074-1.346671-13.021571-3.061732-19.47147l-38.699394-143.286404-27.064402 0 54.987359 189.700503 28.290323 0 38.576597-136.917346c1.794879-6.123464 2.938935-12.57234 3.429099-19.349697l0.490164 0c0.325411 6.858198 1.346671 13.390985 3.061732 19.594267l38.20923 136.672776 28.535917 0 53.149501-189.700503L884.157022 447.3864z"
                                            p-id="5915" data-spm-anchor-id="a313x.7781069.0.i37" class=""
                                            fill="#fdd835"></path>
                                    </svg>

                                </em>
                                <a href="#"></a>
                                <h4>Python入门</h4>
                                <p>第一次来请点这里<br>引领你进入编程的大门</p>
                                </a>
                            </li>
                            <li class="PythonRoad" onclick="toRoad()">
                                <em>
                                    <svg t="1589714602940" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="4895" width="200" height="200">
                                        <path
                                            d="M977.1 965.8H46.9c-24.8 0-44.8-20.1-44.8-44.8V103c0-24.8 20.1-44.8 44.8-44.8H977c24.8 0 44.8 20.1 44.8 44.8v818c0.1 24.8-20 44.8-44.7 44.8z"
                                            fill="#ECEFF1" p-id="4896" data-spm-anchor-id="a313x.7781069.0.i18"
                                            class=""></path>
                                        <path d="M2.1 166.9h1019.8v212.9H2.1z" fill="#3c78aa" p-id="4897"
                                            data-spm-anchor-id="a313x.7781069.0.i20" class="selected"></path>
                                        <path
                                            d="M647.5 251H141.2c-12.4 0-22.4 10-22.4 22.4 0 12.4 10 22.4 22.4 22.4h506.3c12.4 0 22.4-10 22.4-22.4 0-12.4-10.1-22.4-22.4-22.4z"
                                            fill="#FFFFFF" p-id="4898"></path>
                                        <path
                                            d="M882.8 251H757.5c-12.4 0-22.4 10-22.4 22.4 0 12.4 10 22.4 22.4 22.4h125.3c12.4 0 22.4-10 22.4-22.4 0-12.4-10-22.4-22.4-22.4z"
                                            fill="#81C784" p-id="4899"></path>
                                        <path d="M81.6 116.5m-16.8 0a16.8 16.8 0 1 0 33.6 0 16.8 16.8 0 1 0-33.6 0Z"
                                            fill="#F44336" p-id="4900"></path>
                                        <path d="M148.8 116.5m-16.8 0a16.8 16.8 0 1 0 33.6 0 16.8 16.8 0 1 0-33.6 0Z"
                                            fill="#FFC107" p-id="4901"></path>
                                        <path d="M825.3 965.8L703.5 850.5H457V749.6h-44.9l-213.8 9 157 207.2z"
                                            fill="#DADEE0" p-id="4902"></path>
                                        <path
                                            d="M972.6 965.8H480.7L119.9 489.7l213.8-9h44.8v100.9h268.9l11.2 11.2v89.6l240-2.6 123.2 162.6v71.8c0.3 8.9-0.4 17-2.9 22.8-9.6 23.5-30.3 29.7-46.3 28.8z"
                                            fill="#DADEE0" p-id="4903" data-spm-anchor-id="a313x.7781069.0.i17"
                                            class=""></path>
                                        <path
                                            d="M411.1 587.2h-22.4c-9.3 0-16.8-7.5-16.8-16.8V492c0-3.1-2.5-5.6-5.6-5.6h-33.6v-11.2h33.6c9.3 0 16.8 7.5 16.8 16.8v78.4c0 3.1 2.5 5.6 5.6 5.6h22.4v11.2zM691.3 688h-22.4c-9.3 0-16.8-7.5-16.8-16.8v-78.4c0-3.1-2.5-5.6-5.6-5.6h-33.6V576h33.6c9.3 0 16.8 7.5 16.8 16.8v78.4c0 3.1 2.5 5.6 5.6 5.6h22.4V688zM489.6 856.1h-22.4c-9.3 0-16.8-7.5-16.8-16.8v-78.4c0-3.1-2.5-5.6-5.6-5.6h-33.6V744h33.6c9.3 0 16.8 7.5 16.8 16.8v78.4c0 3.1 2.5 5.6 5.6 5.6h22.4v11.3z"
                                            fill="#B0BEC5" p-id="4904"></path>
                                        <path
                                            d="M299.1 514.3H153.4c-18.6 0-33.6-15.1-33.6-33.6 0-18.6 15.1-33.6 33.6-33.6h145.7c18.6 0 33.6 15.1 33.6 33.6 0 18.6-15 33.6-33.6 33.6z"
                                            fill="#4CAF50" p-id="4905"></path>
                                        <path
                                            d="M583.8 615.2H438.2c-18.6 0-33.6-15.1-33.6-33.6 0-18.6 15.1-33.6 33.6-33.6h145.7c18.6 0 33.6 15.1 33.6 33.6s-15.1 33.6-33.7 33.6z"
                                            fill="#2196F3" p-id="4906"></path>
                                        <path
                                            d="M377.5 783.3H231.8c-18.6 0-33.6-15.1-33.6-33.6 0-18.6 15.1-33.6 33.6-33.6h145.7c18.6 0 33.6 15.1 33.6 33.6s-15 33.6-33.6 33.6z"
                                            fill="#F44336" p-id="4907"></path>
                                        <path
                                            d="M870.6 716H724.9c-18.6 0-33.6-15.1-33.6-33.6 0-18.6 15.1-33.6 33.6-33.6h145.7c18.6 0 33.6 15.1 33.6 33.6 0 18.6-15 33.6-33.6 33.6zM668.9 884.1H523.2c-18.6 0-33.6-15.1-33.6-33.6 0-18.6 15.1-33.6 33.6-33.6h145.7c18.6 0 33.6 15.1 33.6 33.6 0 18.6-15 33.6-33.6 33.6z"
                                            fill="#FFC107" p-id="4908"></path>
                                    </svg>
                                </em>
                                <h4>Python知识测试</h4>
                                <p>不知道自己学的如何?<br>来这里测试一下自己吧</p>
                            </li>
                            <li class="gfwd" onclick="toOffcial()">
                                <em>
                                    <svg t="1589713267006" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="790" width="200" height="200">
                                        <path
                                            d="M420.693333 85.333333C353.28 85.333333 298.666667 139.946667 298.666667 207.36v71.68h183.04c16.64 0 30.293333 24.32 30.293333 40.96H207.36C139.946667 320 85.333333 374.613333 85.333333 442.026667v161.322666c0 67.413333 54.613333 122.026667 122.026667 122.026667h50.346667v-114.346667c0-67.413333 54.186667-122.026667 121.6-122.026666h224c67.413333 0 122.026667-54.229333 122.026666-121.642667V207.36C725.333333 139.946667 670.72 85.333333 603.306667 85.333333z m-30.72 68.693334c17.066667 0 30.72 5.12 30.72 30.293333s-13.653333 38.016-30.72 38.016c-16.64 0-30.293333-12.8-30.293333-37.973333s13.653333-30.336 30.293333-30.336z"
                                            fill="#3C78AA" p-id="791"></path>
                                        <path
                                            d="M766.250667 298.666667v114.346666a121.6 121.6 0 0 1-121.6 121.984H420.693333A121.6 121.6 0 0 0 298.666667 656.597333v160a122.026667 122.026667 0 0 0 122.026666 122.026667h182.613334A122.026667 122.026667 0 0 0 725.333333 816.64v-71.68h-183.082666c-16.64 0-30.250667-24.32-30.250667-40.96h304.64A122.026667 122.026667 0 0 0 938.666667 581.973333v-161.28a122.026667 122.026667 0 0 0-122.026667-122.026666zM354.986667 491.221333l-0.170667 0.170667c0.512-0.085333 1.066667-0.042667 1.621333-0.170667z m279.04 310.442667c16.64 0 30.293333 12.8 30.293333 37.973333a30.293333 30.293333 0 0 1-30.293333 30.293334c-17.066667 0-30.72-5.12-30.72-30.293334s13.653333-37.973333 30.72-37.973333z"
                                            fill="#FDD835" p-id="792"></path>
                                    </svg>
                                </em>
                                <h4>Python官方文档</h4>
                                <p>函数不会用?找不到命令?<br>来这里搜索吧</p>
                            </li>
                            <li class="document" onclick="toManual()">
                                <em>
                                    <svg t="1589714402360" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="1187" width="200" height="200">
                                        <path
                                            d="M680.96 640m-281.6 0a281.6 281.6 0 1 0 563.2 0 281.6 281.6 0 1 0-563.2 0Z"
                                            fill="#FED847" p-id="1188"></path>
                                        <path
                                            d="M928.8704 808.96H66.8672V112.64h862.0032v245.76H210.5344v-40.96H887.808V153.6H107.9296v614.4H887.808V399.36h41.0624v409.6zM231.0144 235.52a41.02144 41.02144 0 1 0-41.0624 40.96 40.96 40.96 0 0 0 41.0624-40.8576V235.52z m205.312 0a41.0624 41.0624 0 1 0-41.1648 40.96h0.1024a41.03168 41.03168 0 0 0 41.0624-40.96z m-102.6048 0a41.05216 41.05216 0 1 0-82.1248-0.2048 41.0624 41.0624 0 0 0 40.96 41.1648h0.1024a41.03168 41.03168 0 0 0 41.0624-40.96z m123.0848 471.04H169.472V419.84h287.3344v286.72z m-246.272-40.96H415.744V460.8H210.5344v204.8z m636.20096 40.96H518.3488v-40.96h287.3344v-81.92H518.3488v-40.96h328.38656v163.84z m0-245.76H518.3488v-40.96h328.38656v40.96z"
                                            fill="" p-id="1189"></path>
                                    </svg>
                                </em>
                                <a href="https://study.kingfish404.cn/doc"></a>
                                <h4>实验手册与平台说明</h4>
                                <p>平台的相关文档<br>相关说明</p>
                                </a>
                            </li>

                            <li class="resource" onclick="toResource()">
                                <em>
                                    <svg t="1589714367401" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="10303" width="200" height="200">
                                        <path d="M942.72 889.6H122.24V205.44h820.48z m-756.48-64h692.48V269.44H186.24z"
                                            fill="#6A81AE" p-id="10304"></path>
                                        <path
                                            d="M718.72 414.08l-45.44 45.44 88.32 87.68-88.32 88.32 45.44 45.44 133.76-133.76-133.76-133.12zM341.76 414.08L208 547.2l133.76 133.76 44.8-45.44-87.68-88.32 87.68-87.68-44.8-45.44zM402.368 629.632L612.8 419.2l45.248 45.248-210.432 210.432z"
                                            fill="#DDCC3A" p-id="10305"></path>
                                    </svg>
                                </em>
                                <a href="#"></a>
                                <h4>学习与练习资源</h4>
                                <p>搜集全网知识<br>优质资源在此</p>
                                </a>
                            </li>
                            <li class="feedback" onclick="toFeedback()">
                                <em>
                                    <svg t="1589714499984" class="icon" viewBox="0 0 1024 1024" version="1.1"
                                        xmlns="http://www.w3.org/2000/svg" p-id="4041" width="200" height="200">
                                        <path
                                            d="M860.40576 947.2H166.28224A84.5824 84.5824 0 0 1 81.92 862.59712V166.52288A84.5824 84.5824 0 0 1 166.28224 81.92h461.1328a29.27616 29.27616 0 0 1 0 58.55232H166.28224a26.04032 26.04032 0 0 0-25.99424 26.05056v696.07424a26.04032 26.04032 0 0 0 25.97376 26.05056h694.144a26.04032 26.04032 0 0 0 25.97376-26.05056V375.7312a29.184 29.184 0 1 1 58.368 0v486.86592A84.5824 84.5824 0 0 1 860.40576 947.2z"
                                            fill="#3c78aa" p-id="4042" data-spm-anchor-id="a313x.7781069.0.i14"
                                            class="selected"></path>
                                        <path
                                            d="M935.84384 172.8512l-69.12-76.24704a43.1872 43.1872 0 0 0-61.68064-2.42176L344.064 528.16384l-0.10752 0.10752a43.47392 43.47392 0 0 0-13.06112 25.31328l-26.55744 128.2048-0.47616 3.14368a43.264 43.264 0 0 0 55.1424 45.8496l112.52736-32.768a43.25888 43.25888 0 0 0 18.78528-11.264L934.70208 232.448a43.52 43.52 0 0 0 1.14176-59.5968z m-442.57792 427.3152L422.912 534.22592 765.20448 211.968l54.08768 54.91712z m-126.37696 67.38432l18.33472-88.52992 67.16928 62.93504-0.95744 0.97792zM860.16 225.09056l-52.39808-53.1968 26.0864-24.576 49.23904 54.31808z"
                                            fill="#fdd835" p-id="4043" data-spm-anchor-id="a313x.7781069.0.i10"
                                            class=""></path>
                                    </svg>
                                </em>
                                <h4>反馈</h4>
                                <p>有你的声音<br>HelloPython才能变的更好</p>
                            </li>

                        </ul>
                    </div>

                </div>
                <iframe class="siteIframe" src="/loading" frameborder="0" target="_self" id='iframe'
                    style="margin-top: 5px;"></iframe>
            </div>
            <div class="col-md-5 lab">
                <p class="h3 resultTitle">运行结果</p>
                <p class="costTimeTitle">运行用时:&nbsp;&nbsp;<span class="time"></span>s</p>
                <div id="out" class="col-lg-12"><textarea id="output" disabled
                        placeholder="点击运行,输出的结果就会在这里显示啦&#10;(没有变化的话，是不是忘记print了)" class="form-control"></textarea>
                </div>
                <!-- 代码输入部分 -->
                <p class="h3">
                    输入代码
                </p>
                <form>
                    <textarea id="code" name="code"></textarea>
                </form>
                <div class="text-right">
                    <button id="run" type="button" class="btn btn-primary ">运行</button>
                    <button id="share" type="button" class="btn btn-primary ">分享</button>
                    <input id="copyArea" class="text-center" type="text" value=""></input>
                    <button id="copyButton" type="button" class="btn btn-primary ">复制</button>

                </div>

                <div class="text-left tips">
                    <p class="h3 text-left">提示</p>
                    <div class="tip alert alert-dark" role="alert">
                        <li>如果只输入一行，可以直接计算表达式</li>
                        <li>遇到问题了? 点击分享即可获取分享代码的链接，然后把链接发给他人求助吧</li>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
        integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
        crossorigin="anonymous"></script>
    <script>
        // 工具函数
        function sleep(d) {
            for (var t = Date.now(); Date.now() - t <= d;);
        }

        function IsPC() {
            var userAgentInfo = navigator.userAgent;
            var Agents = ["Android", "iPhone",
                "SymbianOS", "Windows Phone",
                "iPad", "iPod"];
            var flag = true;
            for (var v = 0; v < Agents.length; v++) {
                if (userAgentInfo.indexOf(Agents[v]) > 0) {
                    flag = false;
                    break;
                }
            }
            return flag;
        }

        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) { return pair[1]; }
            }
            return (false);
        }

        // 初始化
        $('.siteIframe').hide();
        $(".start").hide();
        $(".start").css("display", "auto")
        $("#copyArea").hide();
        $("#copyButton").hide();
        var lastCode = "";
        var lastTime = 0;

        // 判断平台是否为PC
        if (IsPC()) {
            var rows = 6;
            document.getElementById('output').rows = rows;
        }


        function get_text_rows(text) {
            return text.split("\n").length;
        }

        function changeSize(ele, rows) {
            if (rows > 50) {
                $(ele).height(window.screen.availHeight / 2.8);
            } else if (rows > 5) {
                $(ele).height("auto");
                ele.rows = rows;
            } else {
                if (IsPC()) {
                    ele.rows = 6;
                } else {
                    ele.rows = rows + 1;
                }
            }
        }

        $('#code').each(function () {
            this.oninput = function () {
                changeSize(this, 2)
            }
        })

        function getCode() {
            return $('#code').val()
        }



        // 页面的跳转函数,隐藏开始菜单，显示iframe，设置.doc的overflow:auto
        function toUrlPage(url) {
            $('.startMenu').hide()
            $('.siteIframe').show();
            $('.siteIframe').attr("src", url);
            $(".doc").css("overflow", "auto");
            $(".start").show();
        }

        function toIndoor() {
            toUrlPage("/doc/Python入门")
        }

        function toRoad() {
            toUrlPage("/road")
        }

        function toManual() {
            toUrlPage("/doc/实验手册")
        }

        function toResource() {
            toUrlPage("/doc/Resource")
        }

        // 返回开始界面
        function toStart() {
            $('.siteIframe').hide();
            $('.startMenu').show(500);
            $('.siteIframe').attr("src", "/loading")
            $(".doc").css("overflow", "auto");
            //  隐藏开始按钮
            $(".start").hide();
        }

        function toOffcial() {
            $('.startMenu').hide()
            $('.siteIframe').show();
            $('.siteIframe').attr("src", "https://docs.python.org/zh-cn/3/")
            $(".doc").css("overflow", "hidden");
            $(".start").show();
        }

        function toFeedback() {
            $('.startMenu').hide()
            $('.siteIframe').show();
            $('.siteIframe').attr("src", "https://forms.office.com/Pages/ResponsePage.aspx?id=DQSIkWdsW0yxEjajBLZtrQAAAAAAAAAAAAN__uylFJ9UOFFRQ0YyMjJWVlIyQlM3NFNEOFlaNTNWNi4u")
            $(".doc").css("overflow", "hidden");
            $(".start").show();
        }

        // 如果只有一行有内容，返回该行
        function ClearBr(key) {
            var data = key.split("\n");
            var countOfVale = 0, mark = 0;
            for (let index = 0; index < data.length; index++) {
                if (data[index] != "") {
                    countOfVale++;
                    mark = index
                }
            }
            if (countOfVale == 1) {
                return data[mark]
            }
            return key;
        }

        function OutPut(data) {
            var ele = document.getElementById('output');
            ele.value = data['output'];
            rows = get_text_rows(data['output']);
            var num = Number(data['time']);

            //决定返回时间多少位小数
            num = num.toFixed(3);
            $(".time").html(num);
            lastTime = num;
            $(".costTimeTitle").show(500);
            changeSize(ele, rows);
        }

        $('#run').click(function () {
            var code = getCode();

            code = ClearBr(code);

            if (!code) {
                document.getElementById('output').value = '请输入代码后运行'
                return;
            } else if (lastCode == code) {
                num = Number(lastTime) + 0.005 * (Math.random() - 0.5);
                num = num.toFixed(3);
                $(".time").html(num);
                return;
            }
            lastCode = code;
            
            $.ajax({
                url: '/api/', //代码发送的地址
                type: 'POST', // 请求类型
                data: {
                    'code': lastCode
                }, //调用代码获取函数，获得代码文本
                dataType: 'json', //期望获取的响应类型为 json
                success: OutPut // 在请求成功之后调用 OutPut 函数，将结果打印到输出框  })})
            })
        })

        function UrlOutPut(data) {
            console.log(data)
            if (data['code'] != "200") {
                return;
            }
            copyArea = $("#copyArea")
            copyArea.val(data['url'])
        }

        $('#share').click(function () {
            var version = "1";
            var code = getCode();
            code = ClearBr(code);
            if (code == "") {
                return;
            }
            code = encodeURIComponent(code)
            $("#copyArea").show();
            $("#copyButton").show();
            copyArea = $("#copyArea")
            var shareUrl = window.location.href;
            shareUrl = shareUrl.split('?');
            shareUrl = shareUrl[0];
            shareUrl = shareUrl + "?v=" + version + "&c=" + code;

            copyArea.val("");

            if (copyArea.val() != "") {
                return;
            }

            copyArea.val(shareUrl);

            console.log(shareUrl);


        })
        $("#copyButton").click(function () {
            copyArea = $("#copyArea")

            copyArea.select()

            if (document.execCommand('copy')) {
                document.execCommand('copy');
                console.log("Copy success");
                copyArea.val("")
                $("#copyArea").val("复制成功,粘贴发送给别人吧");
                $("#copyArea").show().delay(1000).hide(300);
                $("#copyButton").show().delay(1000).hide(300);
            }
        })

        $('.start').click(function () {
            toStart();
        })
        $('.official').click(function () {
            toOffcial();
        })
        $('.manual').click(function () {
            toManual();
        })

        // 代码初始化
        v = getQueryVariable("v")
        switch (v) {
            case "1":
                var code = getQueryVariable("c")
                console.log(code)
                code = decodeURIComponent(code);
                console.log(code)

                $('#code').val(code)
                break;
            default:
                $('#code').val("print('hello world!')")
                break;
        }
    </script>
</body>


</html>